#include "GameObject.h"
#include "Character.h"
#include "Game.h"
#include "Util.h"
#include "StringLib.h"

GameObject::GameObject(GenericType type) {
	m_types[TH_GENERIC_TYPE] = type;
}

GameObject::~GameObject() {
	m_types.clear();
}

std::string GameObject::debugString() const {
	return "GenericType: " + Util::intToString(getType(TH_GENERIC_TYPE)) + " Name: " + getBasicName() + " Description: " + getDescription();
}

void GameObject::logDetails(TextLog& log) const {
	log.addLine(getName());
	log.addLine(getDescription());
}

std::string GameObject::getBasicName() const {
	return g_stringLib->getObjectString(getSpecificTypeCategory(), getSpecificType());
}

std::string GameObject::getName() const {
	return getBasicName();
}

std::string GameObject::getDescription() const {
	return g_stringLib->getObjectString(getSpecificTypeCategory(), getSpecificType(), 1);
}

bool GameObject::typeEqual(const GameObject& obj) const {
	for(int i = 0; i < NUM_HIERARCHY_TYPES; i++) {
		if(getType(TypeHierarchy(i)) != obj.getType(TypeHierarchy(i)))
			return false;
	}
	return true;
}

TypeHierarchy GameObject::getSpecificTypeCategory() const {
	return (*(m_types.rbegin())).first;
}

int GameObject::getSpecificType() const {
	return (*(m_types.rbegin())).second;
}
